function UploadView(controller, loginView) {
	View.call(this, controller);

	this.addNotice = function() {
		var tr = document.createElement("tr");
		var td = document.createElement("td");

		var noticeTable = document.createElement("table");
		noticeTable.className = "notice";
		var noticeTbody = document.createElement("tbody");
		var noticeTr = document.createElement("tr");
		var noticeTd = document.createElement("td");
		noticeTd.className = "notice";
		
		var pre = document.createElement("pre");
		pre.className = "notice";
		var noticeTextNode = document.createTextNode(Language.UploadView.notice);
		pre.appendChild(noticeTextNode);
		noticeTd.appendChild(pre);
		noticeTr.appendChild(noticeTd);
		noticeTbody.appendChild(noticeTr);
		noticeTable.appendChild(noticeTbody);
		td.appendChild(noticeTable);
		tr.appendChild(td);
		this.tbody.appendChild(tr);
	};

	this.addForm = function() {
		// //////////////////////////////////////////////////////////////
		var uploadController = this.getController();
		var uploadFormView = new UploadFormView(uploadController);
		uploadFormView.setUploadHandler(this);
		var formTr = document.createElement("tr");
		var formTd = document.createElement("td");
		var uploadFormTag = uploadFormView.getTag();
		formTd.appendChild(uploadFormTag);
		formTr.appendChild(formTd);
		this.tbody.appendChild(formTr);
		this.setUploadFormView(uploadFormView);
		// //////////////////////////////////////////////////////////////
		
		// //////////////////////////////////////////////////////////////
		var resultUploadTr = document.createElement("tr");
		var resultUploadTd = document.createElement("td");
		resultUploadTd.className = "upload-result";
		this.resultUploadIframe = document.createElement("iframe");
		this.resultUploadIframe.name = "upload-result-frame";
		this.resultUploadIframe.src = "wait.html";
		this.resultUploadIframe.className = "hidden";
		resultUploadTd.appendChild(this.resultUploadIframe);
		resultUploadTr.appendChild(resultUploadTd);
		this.tbody.appendChild(resultUploadTr);
		// //////////////////////////////////////////////////////////////
	};

	this.upload = function(uploadForm) {
		var loginView = this.getLoginView();
		if (loginView.logged()) {
			
			var valid = uploadForm.validate();
			if (valid) {
				this.getUploadFormView().getTag().className = "hidden";
				this.resultUploadIframe.className = "upload-result";
				var form = uploadForm.getForm();
				this.controller.submitForm(form, "upload");
			} else {
				alert(Language.UploadFormView.invalidForm);
			}
		} else {
			alert(Language.UploadView.mustBeLogged);
		}
	};

	this.getTag = function() {
		this.getUploadFormView().getTag().className = "upload";
		this.resultUploadIframe.className = "hidden";
		this.getUploadFormView().getUploadForm().reset();
		
		return this.tag;
	};

	this.getLoginView = function() {
		return this.loginView;
	};

	this.setLoginView = function(loginView) {
		this.loginView = loginView;
	};

	this.getUploadFormView = function() {
		return this.uploadFormView;
	};
	
	this.setUploadFormView = function(uploadFormView) {
		this.uploadFormView = uploadFormView;
	};
	
	// /////////////////////////////////////////////////
	this.tag = document.createElement("table");
	this.tbody = document.createElement("tbody");
	this.tag.appendChild(this.tbody);
	// /////////////////////////////////////////////////
	
	this.resultUploadIframe = null;
	this.uploadFormView = null;
	this.loginView = null;

	this.addNotice();
	this.addForm();
	this.setLoginView(loginView);
}